﻿Imports Cls_Common
Imports VSModel

Partial Class FrontEnd_Control_TopPage
    Inherits System.Web.UI.UserControl
    Public __o As Object
    'Protected Sub lbtnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtnExit.Click
    '    Session("UserName") = Nothing
    '    Session("UserId") = Nothing

    '    Dim retURL As String = IIf(Request("retURL") Is Nothing, ".", Request("retURL"))
    '    Response.Redirect(MainDomain)
    'End Sub


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Using Data As New VSEntities
                Dim _CartId As String = Session("CartId")
                Dim p As VSModel.CalculateSumPriceByCartID_Result = Data.CalculateSumPriceByCartID(_CartId).FirstOrDefault
                If Not p Is Nothing AndAlso Not p.sumPrice Is Nothing Then
                    lblSumOfMoney.Text = "$" & CType(p.sumPrice, Double).ToString("#,##0.#0")
                End If
                lblNumberItem.Text = (From q In Data.ShoppingCarts Where q.CartId = _CartId Select q).Count
            End Using
        End If
    End Sub

End Class
